# $Id: GNUmakefile,v 1.10 2010-01-11 16:17:58 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------

name := DMX
G4TARGET := $(name)
G4EXLIB := true

ifndef G4INSTALL
  #G4INSTALL = ../..
  #G4INSTALL = /scratch/shinichi/geant4.9.5.p01
  G4INSTALL = /storage/ANKOK75/GeantLib/geant4.9.5.p01
endif

ifdef DMXENV_GPS_USE
  CPPFLAGS += -DDMXENV_GPS_USE
endif

include $(G4INSTALL)/config/architecture.gmk

.PHONY: all
all: lib bin ./Objects/ObjectClassDef.cc

ObjectClassDef.cc:
	rootcint -f ./Objects/ObjectClassDef.cc -c ./Objects/ObjectClass.hh ./Objects/ObjectClassLinkDef.h

#---Added By Sugita For ROOT-----------------------------
CPPFLAGS += $(shell $(ROOTSYS)/bin/root-config --cflags)
ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs)
EXTRALIBS += $(ROOTLIBS)
ROOTSYS = /opt/root
#--------------------------------------------------------
#---For ObjectClass--------------------------------------
#LDFLAGS += $(shell root-config --libs) ./Objects/ObjectClassDef.cc
#--------------------------------------------------------
ROOTLIBS += $(shell root-config --libs) -L./Objects -lObjectClass

include $(G4INSTALL)/config/binmake.gmk

visclean:
	rm -f g4*.prim g4*.eps g4*.wrl
	rm -f .DAWN_*

########################### ROOT #################################

ifdef ROOTSYS
ifndef G4UI_USE_ROOT
  ROOTCPPFLAGS   = $(shell $(ROOTSYS)/bin/root-config --cflags)
  #ROOTCPPFLAGS  := $(filter-out -D_REENTRANT,$(ROOTCPPFLAGS))
  #ROOTCPPFLAGS  := $(filter-out -pthread,$(ROOTCPPFLAGS))
  CPPFLAGS      += -DG4ANALYSIS_USE_ROOT $(ROOTCPPFLAGS)
  ROOTLIBS       = $(shell $(ROOTSYS)/bin/root-config --nonew --glibs)
  ROOTLIBS      := $(filter-out -lNew,$(ROOTLIBS))
  #ROOTLIBS      := $(filter-out -lThread,$(ROOTLIBS))
  #ROOTLIBS      := $(filter-out -lpthread,$(ROOTLIBS))
  #ROOTLIBS      := $(filter-out -pthread,$(ROOTLIBS))
  ROOTLIBS      += -lMinuit -lHtml
  LDLIBS        += $(ROOTLIBS)
endif
endif
